Repository navigation
Conversation
Add `void deploy --platform cloudflare --preview <name> [--json]` and `void preview delete <name>`, built on Cloudflare Workers Previews. A Preview is a named, isolated environment of the same Worker with a stable `<name>-<worker>.<subdomain>.workers.dev` URL. Deploying the same name again updates it; production traffic, the active deployment, routes and schedules are never touched, and a Preview gets no production secrets. - @void/deploy-cloudflare: `previews.deploy` / `previews.delete` operations, `deployCloudflarePreview` (sends only `previews.deploy`), `deleteCloudflarePreview` (a missing Preview, 10025, counts as deleted) and name validation. - void: the static deploy prepares its Build Output as a Preview build and publishes it through `cf previews deploy --prebuilt` instead of activating a version. Apps that need a Worker, an existing-Worker handoff, and --atomic/--provision/--require-email are refused before anything is built or uploaded. A preview never saves an account for the project. - --json prints one record on stdout (workerName, previewName, previewUrl, deploymentId, deploymentUrl); progress goes to stderr through an explicit progress stream in output.ts. - When the Worker has Preview URLs turned off, the deploy fails and points at `cloudflare.preview_urls` in void.config.ts. - Help, interactive hints, CLI reference, a pull request workflow in the Cloudflare integration guide, and the skill. Refs voidzero-dev#467, voidzero-dev#471.
Use top-level type imports, numeric separators, type guards instead of casts, and no non-null assertions or trailing-slash regex in the preview code that came in with the merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`void deploy --preview --json` now runs like `void db execute --json`: the deploy runs in a child whose stdout is our stderr, and only the result the child writes to fd 3 reaches stdout. Errors, parse errors and output from void.config.ts no longer mix with the record. The shared runner is renamed to json-command-process.ts, and the progress-stream plumbing in output.ts, deploy-helpers.ts and deploy-summary.ts is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move preview cleanup next to rollback as `void project preview delete <name> [--platform cloudflare]`, so it does not clash with `vp preview`. It uses the same Worker and account as rollback and logs. A Preview that does not exist is not an error; a missing Worker or any other failure exits 1. The name is checked before any config is read. The top-level `void preview` command, its help and the uploader opt-out in the deploy helpers are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Before connecting, `deploy --preview` now checks the name with a small parser (no regex), and needs `cloudflare.name` and a pinned account, so the deploy and `void project preview delete` reach the same Worker. The workers.dev length rule is checked against that name. The upload first reads the Worker's deployment status: cf would create a missing Worker without asking, so a Worker with no production deployment stops with nothing uploaded. The staged config keeps only an allow-list of keys, so a preview gets none of the Worker's bindings, vars or migrations. A deploy with Preview URLs off reports the deployment it made and how to turn them on. The cf runner decodes the Preview record from its parsed stdout JSON. The preview tail moves to cloudflare-preview.ts. The account save and queue-cleanup read go back to main's code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document `void deploy --preview` and `void project preview delete`: the requirements (production first, `cloudflare.name`, a pinned account), the JSON record, failure output and naming rules. The GitHub Actions example now passes values through `env:`, skips fork and Dependabot pull requests, comments once and cleans up from the base branch. Update the deploy help rows, the skill and the package notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A menu hint with a <...> part now needs input, so Enter on an empty "delete <name>" no longer runs into a usage error. The menu splits a hint of several words into separate arguments, so parseProjectArgs stays strict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With a Worker name of 62 or 63 characters no preview name fits on workers.dev, so say that instead of "use at most 0". The account and delete messages name the right config file, and the 63-character limit is shared from @void/deploy-cloudflare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build the cf previews deploy dry run from previewStaticWorkerConfig and writeCloudflareStaticDeployConfig, the shape a preview deploy uploads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the interactive menu entry a hint, as zero-trust and security are, so the shared prompt and argument builder stay unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @messenjer, this is a solid base, and the live-run notes in the body helped a lot. I pushed a set of maintainer commits on top of your branch (your commit stays as it is; we'll squash with you as co-author). This comment explains what changed and why. Your two questions
Flow after the changesWhat changed, and why
Live run on a throwaway Workers Free account (cf 1.0.0-rc.5)
PR bodyPlease change "Closes #467" to "Part of #467": this covers static sites and SPAs, while #467 also asks about full-stack apps. Also drop "open beta", and change "never shares production D1/KV/R2" to "a static preview gets none of the Worker's bindings, vars or secrets". The commands in the live-run table are now Follow-up (not this PR)Previews for Worker apps need a product decision first: bind a Preview to one shared staging set of D1/KV/R2 (Cloudflare's advice, fits Workers Free) or to per-PR resources that Void creates and deletes? And should secrets come through cf |
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4a4e24de4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
Part of #467. Related: #471 (a preview reuses an earlier build step's static output with
--skip-build, like a production deploy; Worker apps still need a fresh build).Open questions for maintainers
Two design choices shape the public surface. I'd like your call on them before polishing further:
versions upload --preview-alias, and the plumbing for it already exists. This PR uses Workers Previews instead, because Cloudflare now recommends them for branch and pull request testing: aliased version URLs share production resources and can only be removed by deleting the version. The trade-off is that Previews are in open beta, so Void would depend on a beta API and on thecfCLI'spreviewscommands. Are you comfortable with that, or would you rather start with aliases?void preview delete <name>adds a top-levelpreviewgroup. In the Vite ecosystem, "preview" usually means the local server for a build (vite preview,vp preview), so this may read ambiguously. Alternatives:void cloudflare preview delete <name>, or a flag on deploy such asvoid deploy --platform cloudflare --delete-preview <name>. Which do you prefer?Summary
Per-pull-request previews for
void deploy --platform cloudflare, built on Cloudflare's Workers Previews rather thanversions upload --preview-alias. A Preview has a stable URL, never takes production traffic, gets no production secrets, and can be deleted by name. Cloudflare now advises against aliased version URLs for branch previews because they run against production resources.--jsonoutput:{"workerName":"my-app","previewName":"pr-64","previewUrl":"https://pr-64-my-app.team.workers.dev","deploymentId":"…","deploymentUrl":"https://…-my-app.team.workers.dev"}Decisions:
CLOUDFLARE_API_TOKEN(andCLOUDFLARE_ACCOUNT_ID) are needed. The URL comes from Cloudflare's response, soCLOUDFLARE_WORKERS_SUBDOMAINis not needed.preview_urlsturned off, Cloudflare returns no URL; the deploy fails and says to setcloudflare.preview_urlsinvoid.config.ts.[a-z0-9-], starting and ending with a letter or digit;<name>-<worker>must fit in 63 characters.Docs:
docs/reference/cli/deploy.md,docs/reference/cli.md, a pull request workflow (deploy, comment the URL, delete on close) indocs/integrations/cloudflare.md, and one line inpackages/void/skills/void.Evidence
wrangler versions upload --preview-alias pr-64+grep -oE "https://pr-64-…workers.dev"void deploy --platform cloudflare --dir dist --spahttps://<worker>.<subdomain>.workers.devservesproduction-1, active version<version>at 100%… --preview pr-1 --jsonhttps://pr-1-<worker>.<subdomain>.workers.devservespr-1 push-1; SPA deep links return the shellpr-1 push-2; the first deployment URL still servespush-1… --preview pr-2 --jsonpr-1andpr-2serve side by sidecf workers deployments listafter each step<version>at 100%, bodyproduction-1void deploy --platform cloudflare --dir dist --spacloudflare.preview_urls: false, then--preview pr-3void.config.tshint, empty stdoutvoid preview delete pr-1, run twiceThe live run found and fixed three bugs that unit tests could not catch: the Build Output needed
isPreview: true,cf previews deletedoes not read a name after--, and a missing Preview is error 10025, not 10007.Tests:
vp run checkand the fullvp test runpass (807 files, 17,052 tests).Merge Danger
Door: two-way
New flags and a new command; the production deploy path is unchanged apart from an
isPreview: falsedefault passed through the static Build Output preparation.Blast Radius: small
Risk sits in the opt-in
--previewpath, which depends on Cloudflare Workers Previews (open beta) and the pinnedcfCLI'spreviewscommands. A change in either breaks previews, not production deploys.🤖 Generated with Claude Code